package com.quanz.ckgl.services.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

/**
 * 入库信息
 * 
 * @author James Quan
 * @version 2015年10月3日 下午10:18:35
 */
@Entity
@Table(name = "WAREHOUSE_WARRANT")
public class WarehouseWarrantEntity implements Serializable {
	private Long id;
	private ProductEntity product;
	private RackEntity rack;
	private int layer;
	private int col;
	private int quantity;
	private DateTime storageTime;
	private UserEntity user;

	@Id
	@GeneratedValue(generator = "qsIdGenerator")
	@GenericGenerator(name = "qsIdGenerator", strategy = "org.hibernate.id.enhanced.TableGenerator", parameters = {
			@Parameter(name = "table_name", value = "CKGL_SEQUENCES"),
			@Parameter(name = "segment_column_name", value = "ID_NAME"),
			@Parameter(name = "value_column_name", value = "ID_VAL"),
			@Parameter(name = "segment_value", value = "WAREHOUSE_WARRANT"),
			@Parameter(name = "increment_size", value = "1") })
	@Column(name = "ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name = "PRODUCTID", nullable = false)
	public ProductEntity getProduct() {
		return product;
	}

	public void setProduct(ProductEntity product) {
		this.product = product;
	}

	@ManyToOne
	@JoinColumn(name = "RACKID", nullable = false)
	public RackEntity getRack() {
		return rack;
	}
	
	public void setRack(RackEntity rack) {
		this.rack = rack;
	}

	@Column(name = "LAYER", nullable = false)
	public int getLayer() {
		return layer;
	}

	public void setLayer(int layer) {
		this.layer = layer;
	}

	@Column(name = "COL", nullable = false)
	public int getCol() {
		return col;
	}

	public void setCol(int col) {
		this.col = col;
	}
	
	@Column(name = "QUANTITY", nullable = false)
	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	@Column(name = "STORAGETIME", nullable = false)
	@Type(type = "com.quanz.ckgl.services.hibernate.DateTimeType")
	public DateTime getStorageTime() {
		return storageTime;
	}

	public void setStorageTime(DateTime receiveTime) {
		this.storageTime = receiveTime;
	}

	@ManyToOne
	@JoinColumn(name = "USERID", nullable = false)
	public UserEntity getUser() {
		return user;
	}
	
	public void setUser(UserEntity user) {
		this.user = user;
	}

}
